<html>
   <head>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body onload="">
<h2 class="comptitle">NED File <i>examples/ieee802154Narrow/ieee802154Narrow.ned</i></h2>
<table class="typetable">
   <tr>
      <th>Name</th>
      <th>Description</th>
   </tr>
<tr>
   <td>
      <a href="org.mixim.examples.ieee802154Narrow.ieee802154Narrow.html">ieee802154Narrow</a>
      <i> (network)</i>
   </td>
   <td>

<p>This example shows how to use MiXiMs implementation of the ieee802154
narrow band protocol. It also provides an example on using the global 
blackboard provided by <a href="org.mixim.base.modules.BaseWorldUtility.html">BaseWorldUtility</a>.</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Source code:</h3>
<pre class="src"><span style="color: #800000; font-weight: bold; ">package</span><span style="color: #000000; "> </span><span style="color: #000000; ">org</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mixim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">examples</span><span style="color: #000000; ">.</span><span style="color: #000000; ">ieee802154Narrow</span><span style="color: #000000; ">;

</span><span style="color: #800000; font-weight: bold; ">import</span><span style="color: #000000; "> </span><span style="color: #000000; ">org</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mixim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">base</span><span style="color: #000000; ">.</span><span style="color: #000000; ">connectionManager</span><span style="color: #000000; ">.</span><span style="color: #000000; ">ConnectionManager</span><span style="color: #000000; ">;
</span><span style="color: #800000; font-weight: bold; ">import</span><span style="color: #000000; "> </span><span style="color: #000000; ">org</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mixim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">base</span><span style="color: #000000; ">.</span><span style="color: #000000; ">modules</span><span style="color: #000000; ">.</span><span style="color: #000000; ">BaseWorldUtility</span><span style="color: #000000; ">;

</span><span style="color: #808080; font-style: italic; ">//
//This example shows how to use MiXiMs implementation of the ieee802154
//narrow band protocol. It also provides an example on using the global 
//blackboard provided by BaseWorldUtility.
//
//The network consist of the &quot;WorldUtilityStats&quot; which extends from 
//BaseWorldUtility to collect some global statistics as well as the 
//usual ConnectionManager and a number of host.
//The hosts contain a special Traffic generation layer (also shows how 
//to publish global statistics to the global blackboard) which lies 
//directly above the NIC which moreover consist of the &quot;csma&quot;-mac 
//layer module and the PhyLayer. The PhyLayer uses &quot;Decider802154Narrow&quot;
//as a decider.
//
//There are three &quot;Test&quot;s which try to show the characteristics of the
//used csma mac layer. For each of these tests exists a &quot;runTestX.sh&quot; 
//script as well as a &quot;TestX.anf&quot; file which execute the configurations 
//necessary to produce the result-files for the according &quot;*.anf&quot; file.
//So you can take a look at the result of these tests by calling the 
//&quot;runTestX.sh&quot; script and then opening the according &quot;TestX.anf&quot; file.
//
//------------------------------
//Test 1
//
//This configuration produces the usage statistics of the channel for 
//different parameters. Usage statistics means how much of the 
//channels possible maximum capacity is used at which amount of generated
//traffic.
//
//The results of this tests are visualized by &quot;Test1.anf&quot; and show plots 
//of the generated traffic against the received traffic where both values
//are normalized against bitrate and simulation time.
//If everything was fine this should plot 5 lines which converge with
//different speeds to a channel usage of about 0.8 (depending on the used 
//parameters).
//You also might see strange outliers in a few of these lines. These seem
//to be caused by wrong reading of the output scalars. The outliers are not
//present in the actual output scalars. You can read and plot the output 
//scalars using matlab to verify this.
//
//------------------------------
//Test 2
//
//These test configurations are meant to show the effect of MAC-ACKS on the
//usage of the channel with increasing distance between the hosts.
//Test2-C further shows the effect of the hidden station problem on CSMA.
//
//The results can be visualized by &quot;Test2.anf&quot; and show plots of channel 
//usage at different distances.
//The graph shows three lines plotting the channel usage against the distance
//between the nodes. You should see that channel usage begins to decrease
//rapidly around a distance of 170 metres. Whereas the run with MAC-Acks 
//enabled should begin decreasing later than the run without.
//The third line shows the performance in the hidden station scenario. It
//should show a huge performance decrease at a distance around 120 metres.
//This is the point where the two senders are not in range of each other
//anymore and begin to interfere each others transmissions to the receiver.
//
//-----------------------------
//Test 3
//
//This tests is meant to show that CSMA uses exponential backoffs. This is 
//done by increasing the number of hosts in the network exponentially.
//While the average backoff duration of each hosts should increase
//exponentially, the average number of backoffs should increase linearly.
//
//The results of this tests are visualized by &quot;Test3.anf&quot;.
//It should show four bar charts displaying the following parameters for 
//each run.
//- Chart 1 - average number of transmitted frames per node.
//			  These bars should be between 5 and 10 frames per node.
//- Chart 2 - average number of backoffs per node.
//			  These bars should increase almost linear with each run. This results
//			  from the exponential backoffs.
//- Chart 3 - average time spent in backoff per node.
//			  These bars should increase exponential with each run.
//- Chart 4 - amount of nodes present.
//			  These bars should increase exponential 2, 4, 8, 16, 32, ...
//
</span><span style="color: #800000; font-weight: bold; ">network</span><span style="color: #000000; "> </span><span style="color: #000000; ">ieee802154Narrow</span><span style="color: #000000; ">
{
    </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
        </span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">playgroundSizeX</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">m</span><span style="color: #000000; ">); </span><span style="color: #808080; font-style: italic; ">// x size of the area the nodes are in (in meters)
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">playgroundSizeY</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">m</span><span style="color: #000000; ">); </span><span style="color: #808080; font-style: italic; ">// y size of the area the nodes are in (in meters)
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">playgroundSizeZ</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">m</span><span style="color: #000000; ">); </span><span style="color: #808080; font-style: italic; ">// z size of the area the nodes are in (in meters)
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">numHosts</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// total number of hosts in the network
</span><span style="color: #000000; ">
        </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;bgb=$playgroundSizeX,$playgroundSizeY,white,,;bgp=10,50&quot;</span><span style="color: #000000; ">);
    </span><span style="color: #800000; font-weight: bold; ">submodules</span><span style="color: #000000; ">:
        </span><span style="color: #000000; ">world</span><span style="color: #000000; ">: </span><span style="color: #000000; ">WorldUtilityStats</span><span style="color: #000000; "> {
            </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
                </span><span style="color: #000000; ">playgroundSizeX</span><span style="color: #000000; "> = </span><span style="color: #000000; ">playgroundSizeX</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">playgroundSizeY</span><span style="color: #000000; "> = </span><span style="color: #000000; ">playgroundSizeY</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">playgroundSizeZ</span><span style="color: #000000; "> = </span><span style="color: #000000; ">playgroundSizeZ</span><span style="color: #000000; ">;
                </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;p=129,40;i=misc/globe&quot;</span><span style="color: #000000; ">);

        }
        </span><span style="color: #000000; ">connectionManager</span><span style="color: #000000; ">: </span><span style="color: #000000; ">ConnectionManager</span><span style="color: #000000; "> {
            </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
                </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;p=225,40;b=42,42,rect,yellow;i=abstract/multicast&quot;</span><span style="color: #000000; ">);

        }
        </span><span style="color: #000000; ">node</span><span style="color: #000000; ">[</span><span style="color: #000000; ">numHosts</span><span style="color: #000000; ">]: </span><span style="color: #000000; ">PhyMacHost</span><span style="color: #000000; "> {
            </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
                </span><span style="color: #000000; ">numHosts</span><span style="color: #000000; "> = </span><span style="color: #000000; ">numHosts</span><span style="color: #000000; ">;
                </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;p=75,130;b=42,42,rect,yellow;i=device/wifilaptop&quot;</span><span style="color: #000000; ">);

        }
    </span><span style="color: #800000; font-weight: bold; ">connections</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">allowunconnected</span><span style="color: #000000; ">:
                         </span><span style="color: #808080; font-style: italic; ">// all connections and gates are to be generated dynamically
</span><span style="color: #000000; ">
}

</span></pre>
   <hr><p class="footer"><a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top"><img src="by-sa.png"></a> This documentation is released under the <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top">Creative Commons license</a></p>
   </body>
</html>
